package view.Core;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.Toast;
import android.widget.AdapterView.OnItemClickListener;

public class A3Activity extends Activity {

	public static final int login = Menu.FIRST + 0;
	public static final int DataSynchronization = Menu.FIRST + 1;
	private static final int REQUEST_CODE = 3434;///login out
	private static final int REQUEST_Data_S_CODE = 36024700;///DataSynchronization
	
	boolean loginStatic = false;
	String loginName, Password;

	private Object[] activities = { "hello", A3Activity2.class, "findTree", encodeActivity.class, "Update Tree", treeDataUpdate.class

	};

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.maindisplay);

		CharSequence[] list = new CharSequence[activities.length / 2];
		for (int i = 0; i < list.length; i++) {
			list[i] = (String) activities[i * 2];
		}

		ArrayAdapter<CharSequence> adapter = new ArrayAdapter<CharSequence>(
				this, android.R.layout.simple_list_item_1, list);
		ListView listView = (ListView) findViewById(R.id.ListView01);
		listView.setAdapter(adapter);

		listView.setOnItemClickListener(new OnItemClickListener() {

			public void onItemClick(AdapterView<?> parent, View view,
					int position, long id) {
					Intent intent = new Intent(A3Activity.this,
							(Class<?>) activities[position * 2 + 1]);
/*
					Bundle bundle = new Bundle();
					bundle.putString("loginName", loginName);
					intent.putExtras(bundle);
*/
					startActivity(intent);
			}
		});
	}

	
	
	
	
	
	public void errorMSG() {
		Toast.makeText(this, "To do this," + '\n' + "You should login First!!",
				Toast.LENGTH_LONG).show();
	}


	
		/*
		if (resultCode == REQUEST_Data_S_CODE && requestCode == REQUEST_Data_S_CODE) {
			if (data.hasExtra("loginName")) {
				Toast.makeText(this, "You now can access the system!",
						Toast.LENGTH_LONG).show();
			}
		}	
		*/

	

}